Class Timer

Summary

Fully Qualified Name: CodeIgniter\Debug\Timer

Description

Class Timer

Provides a simple way to measure the amount of time that elapses between two points.

NOTE: All methods are static since the class is intended to measure throughout an entire application's life cycle.

Methods

Name Description Defined By
getElapsedTime() Returns the duration of a recorded timer. Timer
getTimers() Returns the array of timers, with the duration pre-calculated for you. Timer
has() Checks whether or not a timer with the specified name exists. Timer
start() Starts a timer running. Timer
stop() Stops a running timer. Timer

Method Details

getElapsedTime()

Returns the duration of a recorded timer.

Parameter Name Type Description
$name string The
$decimals int Number

Returns: null|float Returns null if timer exists by that name. Returns a float representing the number of seconds elapsed while that timer was running.

getTimers()

Returns the array of timers, with the duration pre-calculated for you.

Parameter Name Type Description
$decimals int Number

Returns: array

has()

Checks whether or not a timer with the specified name exists.

Parameter Name Type Description
$name string

Returns: bool

start()

Starts a timer running.

Multiple calls can be made to this method so that several execution points can be measured.

Parameter Name Type Description
$name string The
$time float Allows

Returns: \Timer

stop()

Stops a running timer.

If the timer is not stopped before the timers() method is called, it will be automatically stopped at that point.

Parameter Name Type Description
$name string The

Returns: \Timer

Top